Skip to content

ViewModelViewHost class

Attributes: [RequiresUnreferencedCode("This method uses reflection to determine the view model type at runtime, which may be incompatible with trimming.")] [RequiresDynamicCode("If some of the generic arguments are annotated (either with DynamicallyAccessedMembersAttribute, or generic constraints), trimming can't validate that the requirements of those annotations are met.")] [DebuggerDisplay("{ViewModel}")]

Defined in

Namespace: ReactiveUI.Reactive.Maui Assembly: ReactiveUI.Maui.Reactive.dll Full name: ReactiveUI.Reactive.Maui.ViewModelViewHost<T> Modifiers: public

Summary

View source

        This content view will automatically load and host the view for the given view model. The view model whose view is
        to be displayed should be assigned to the inherited view-model property. Optionally, the chosen view can be
        customized by specifying a contract through the inherited contract members.
        

Applies to

net10.0, net10.0-android36.0, net10.0-ios26.0, net10.0-macos26.0, net10.0-windows10.0.19041, net10.0-browserwasm1.0, net10.0-desktop1.0, net10.0-maccatalyst26.0, net10.0-tvos26.0, net9.0-desktop1.0, net9.0-windows10.0.19041

Class hierarchy
classDiagram
class ViewModelViewHost~T~
class ViewModelViewHost
ViewModelViewHost <|-- ViewModelViewHost~T~
class IViewFor~TViewModel~ {
    <>
}
IViewFor~TViewModel~ <|.. ViewModelViewHost~T~
class IViewFor {
    <>
}
IViewFor <|.. ViewModelViewHost~T~
class IActivatableView {
    <>
}
IActivatableView <|.. ViewModelViewHost~T~

Inherits from: ViewModelViewHost

Implements: IViewFor, IViewFor, IActivatableView

Remarks

        This is the AOT-compatible generic version of ViewModelViewHost. It uses compile-time type information
        to resolve views without reflection, making it safe for Native AOT and trimming scenarios.
        

Constructors

NameSummary
.ctor

Properties

NameSummary
ViewModelGets or sets the view model whose associated view is to be displayed.

Methods

NameSummary
ResolveViewForViewModelResolves and displays the view for the given view model with respect to the contract. This method uses the generic ResolveView method which is AOT-compatible.
Inherited members